package com.gmu.service.impl;

import com.gmu.domain.ResResult;
import com.gmu.pojo.TblMenu;
import com.gmu.mapper.TblMenuMapper;
import com.gmu.service.TblMenuService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.List;

/**
 * <p>
 * 权限表 服务实现类
 * </p>
 *
 * @author testjava
 * @since 2022-07-24
 */
@Service
public class TblMenuServiceImpl extends ServiceImpl<TblMenuMapper, TblMenu> implements TblMenuService {

    @Autowired
    private TblMenuMapper tblMenuMapper;

    @Override
    public ResResult<?> getMenusByAdminId(Integer id) {
        List<TblMenu> tblMenus =  tblMenuMapper.getMenusByAdminId(id);
        if (CollectionUtils.isEmpty(tblMenus)){
            return new ResResult<>(404,"没有数据");
        }
        return new ResResult<>(200,tblMenus);
    }
}
